#ifndef _ASSIGNEXPRESSION_HPP
#define _ASSIGNEXPRESSION_HPP

#include <string>
#include "Token.hpp"
#include "Expression.hpp"

namespace ast {
	class AssignExpression : public Expression {
	public:
		AssignExpression(TOKEN token, string op) {
			_token = token;
			_op = op;
		}

		virtual void ExpressionNode() override {
		
		}

		virtual string tokenLiteral() override {
			return _token._literal;
		}

		virtual string String() override {
			string out;
			out.append(_name->String() + " ");
			out.append(_op + " ");
			out.append(_right->String());
			out.append(";");
			return out;
		}

		virtual ~AssignExpression() {
			if (_name != nullptr) {
				delete _name;
			}
			if (_right != nullptr) {
				delete _right;
			}
		}

	public:
		TOKEN _token;
		Expression* _name{ nullptr };
		string _op;
		Expression* _right{ nullptr };
	};
}

#endif // !_ASSIGNEXPRESSION_HPP
